#pragma once
#include "stdafx.h"
#include "CBaseApp.h"
#include "CGraphics.h"
#include "CTimer.h"

class CFramework
{
public:
	CFramework( CBaseApp* pGameApp );
	~CFramework(void);

	HRESULT					InitWindow( char* title, HINSTANCE hInstance, int width, int height, BOOL windowed );
	HRESULT					InitDevice();

	static LRESULT CALLBACK	WndProc( HWND, UINT, WPARAM, LPARAM );

	void					Pause( BOOL rendering, BOOL timer );
	void					Run();

	float					GetFPS();

	HWND					GethWnd() { return g_hWnd; }

private:
	HINSTANCE               g_hInst;
	HWND                    g_hWnd;

	CBaseApp*				g_pGameApp;
	CGraphics*				g_pGraphics;
	CTimer*					g_pTimer;

	BOOL					g_renderingPaused;
	BOOL					g_timerPaused;
	int						g_renderingPauseCount;
	int						g_timerPauseCount;

	void					OnUpdateFrame();
	void					OnRenderFrame();

	void					OnCreateDevice();
};

